// filename: XEndPoint.h
// author: enic
// date: 2015-11-30

#pragma once


#include "string_utf_convert.h"
#include <WinSock2.h>


class XEndPoint
{
public:
	XEndPoint()
	{

	}

	void SetPort(uint16_t nPort)
	{
		m_nPort = nPort;
	}

	void SetIp(const std::wstring& strIp)
	{
		m_strIp = strIp;
	}

	uint16_t GetPort() const
	{
		return m_nPort;
	}

	uint32_t GetIp() const
	{
		return ::inet_addr(XU16T8(m_strIp).c_str());
	}

	std::wstring GetIpAsWString() const
	{
		return m_strIp;
	}

	std::string GetIpAsString() const
	{
		return XU16T8(m_strIp);
	}

private:
	uint16_t m_nPort;
	std::wstring m_strIp;
};